package main

import (
    "fmt"
    "os"
    "strconv"

    "github.com/Luxurioust/excelize"
)

func main() {
    xlsx, err := excelize.OpenFile("./Workbook.xlsx")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    // Get value from cell by given sheet index and axis.
    cell, err := xlsx.GetCellValue("Sheet1", "B2")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    fmt.Println(cell)
    // Get sheet index.
    index := xlsx.GetSheetIndex("Sheet2")
    // Get all the rows in a sheet.
    rows, err := xlsx.GetRows("Sheet" + strconv.Itoa(index))
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    for _, row := range rows {
        for _, colCell := range row {
            fmt.Print(colCell, "\t")
        }
        fmt.Println()
    }
}
